package com.dyw.Ba03;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @auther Devil
 * @create 2022-01-06-15:03
 */

@Component("Student")
public class Student {
    /**
     * @value简单类型的属性赋值 属性: value 是String类型的,表示简单类型的属性值
     * 位置:1.在属性定义的上面,无需set方法,推荐使用.
     * 2.在set方法上面
     */
    //@Value(value = "20")
    private int age;
    @Value(value = "丁杨维")
    private String name;

    private String school;

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", school='" + school + '\'' +
                '}';
    }

    @Value("20")
    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public Student() {
    }

    public Student(int age, String name, String school) {
        this.age = age;
        this.name = name;
        this.school = school;
    }
}
